export const sqlData = [
    { id: 1, statement: "show database_mode"},
    //模式管理
    //创建模式
    { id: 2, statement: "create schema  s1;"},
    { id: 3, statement: "create schema  s2;"},
    //查询模式信息
    { id: 4, statement: " select * from sys_namespace where nspname in ('s1','s2');"} ,
    //使用模式
    { id: 5, statement: "create table s1.test(id int, name varchar(20));" },
    { id: 6, statement: "insert into  s1.test values ('1','kingbase');" },
    { id: 7, statement: "select * from s1.test;" },
    //更改模式
    { id: 8, statement: "alter schema s2 rename to s2_new;" },
    { id: 9, statement: "select * from sys_namespace where nspname='s2_new';" },
    //删除模式
    { id: 10, statement: "drop schema  s2_new cascade;" },

    //表管理
    //创建表(orders)
    { id: 11, statement: "create table s1.orders(\norder_id int constraint pk_orders primary key,\n	customer_name varchar(10) not null,\n	employee_id int,\n	order_date date\n);"},
    { id: 12, statement: "create table s1.customer(\ncustomer_name varchar(10) not null,\ncust_id int\n);"},
    //修改表结构
    { id: 13, statement: "alter table s1.customer rename to customer_new;"},
    { id: 14, statement: "alter table s1.customer_new add column (new_col varchar(20));"},
    //插入表数据
    { id: 15, statement: "insert into s1.orders values(101,'rdjc',1,'1999-03-20');"},
    { id: 16, statement: "insert into s1.orders(order_id, customer_name) values(104,'adjc');"},
    { id: 17, statement: "insert into s1.orders values \n(103,'gdjc',4,'1989-03-20'),\n(105,'sdjc',1,'1999-03-20');"},
    //更新表数据
    { id: 18, statement: "update s1.orders set employee_id = 3 where order_id = 104;"},
    //删除表数据
    { id: 19, statement: "delete from  s1.orders where order_id = 103;"},
    //查询表数据
    { id: 20, statement: "select * from s1.orders;"},
    { id: 21, statement: "select employee_id from  s1.orders;"},
    { id: 22, statement: "select distinct employee_id from  s1.orders;"},
    { id: 23, statement: "select * from  s1.orders where order_id > 104;"},
    { id: 24, statement: "select * from  s1.orders order by order_id;"},
    { id: 25, statement: "select count(order_id), employee_id from  s1.orders group by employee_id;"},
    //删除表
    { id: 26, statement: "drop table s1. customer_new;"},

    //用户管理
    //创建用户
    { id: 27, statement: "create user zkjc with password '123456';"},
    { id: 28, statement: "create user test with password '123456';"},
    //修改用户
    { id: 29, statement: "alter user test password '654321';"},
    { id: 30, statement: "alter user test connection limit 10;"},
    { id: 31, statement: "alter user test createrole;"},
    { id: 32, statement: "alter user test rename to joe;"},
    //查看用户
    { id: 33, statement: "select * from sys_user where usename in ('zkjc','joe');"},
    //授予权限
    { id: 34, statement: "grant insert, update on s1.orders to joe;"},
    { id: 35, statement: "grant select on s1.orders to zkjc, joe;"},
    //撤销权限
    { id: 36, statement: "revoke insert, update on s1.orders from joe;"},
    { id: 37, statement: "revoke select on s1.orders from zkjc, joe;"},

    //索引管理
    //创建索引
    { id: 38, statement: "create index idx_employee on s1.orders(employee_id);"},
    { id: 39, statement: "create index idx_orders on s1.orders(order_id, order_date);"},
    { id: 40, statement: "create unique index uid_order on s1.orders(order_id);"},
    { id: 41, statement: "create unique index uid_orders on s1.orders(order_id, order_date);"},
    //修改索引
    { id: 42, statement: "alter index s1.idx_employee rename to idx_employeeid"},
    { id: 43, statement: "alter index s1.idx_employeeid set(fillfactor = 60);"},
    //查看索引
    { id: 44, statement: "select * from sys_indexes where schemaname='s1';"},
    //重建索引
    { id: 45, statement: "reindex index s1.idx_employeeid;"},
    { id: 46, statement: "reindex table s1.orders;"},
    //删除索引
    { id: 47, statement: "drop index s1.idx_employeeid;"},
    { id: 48, statement: "drop index s1.idx_orders cascade;"},

    //视图管理
    //创建视图
    { id: 49, statement: "create view s1.orders_info as select order_id, customer_name from s1.orders;"},
    //查询视图定义
    { id: 50, statement: "select * from sys_catalog.sys_views where viewname = 'orders_info';"},
    //查询视图
    { id: 51, statement: "select * from s1.orders_info;"},
    //修改视图
    { id: 52, statement: "alter view s1.orders_info rename to orders_new;"},
    //删除视图
    { id: 53, statement: "drop view s1.orders_new;"}



    // { id: 8, statement: "GRANT SELECT ON kes.department TO Kingbase;" },
    // {
    //     id: 8,
    //     statement:
    //         "SELECT username,account_status,created FROM dba_users WHERE username='Kingbase';",
    //     output: [
    //         {
    //             USERNAME: "kingbase123",
    //             ACCOUNT_STATUS: "OPEN",
    //             CREATED: "2024-10-15 16:00:23",
    //         },
    //     ],
    //     tableColumns: [
    //         { prop: "USERNAME", label: "USERNAME" },
    //         { prop: "ACCOUNT_STATUS", label: "ACCOUNT_STATUS" },
    //         { prop: "CREATED", label: "CREATED" },
    //     ],
    // },
    // {
    //     id: 9,
    //     statement: "conn Kingbase/kingbase123;",
    //     comment: "服务器处于普通打开状态",
    // },
    // {
    //     id: 10,
    //     statement: "SELECT user FROM DUAL;",
    //     output: [{ user: "Kingbase" }],
    //     tableColumns: [{ prop: "user", label: "USER()" }],
    // },
    // {
    //     id: 11,
    //     statement:
    //         "CREATE TABLE employee\n(\n  employee_id INTEGER,\n  employee_name VARCHAR2(20) NOT NULL,\n  hire_date DATE,\n  salary INTEGER,\n  department_id INTEGER NOT NULL\n);",
    //     sqlType: "create",
    // },
    // {
    //     id: 12,
    //     statement:
    //         "SQL> CREATE TABLE department\n(\n  department_id INTEGER PRIMARY KEY,\n  department_name VARCHAR(30) NOT NULL\n);",
    // },
    // {
    //     id: 13,
    //     statement: "ALTER TABLE employee MODIFY( hire_date not null);",
    // },
    // {
    //     id: 14,
    //     statement:
    //         "ALTER TABLE employee ADD constraint pk_empid\nPRIMARY KEY(employee_id);",
    // },
    // {
    //     id: 15,
    //     statement:
    //         "ALTER TABLE employee ADD constraint fk_dept FOREIGN KEY\n(department_id) REFERENCES department (department_id);",
    // },
    // {
    //     id: 16,
    //     statement:
    //         "SELECT table_name, constraint_name, constraint_type FROM\n all_constraints WHERE owner='Kingbase' AND table_name='EMPLOYEE';",
    //     output: [
    //         {
    //             TABLE_NAME: "EMPLOYEE",
    //             CONSTRAINT_NAME: "PK_EMPID",
    //             CONSTRAINT_TYPE: "P",
    //         },
    //         {
    //             TABLE_NAME: "EMPLOYEE",
    //             CONSTRAINT_NAME: "FK_DEPT",
    //             CONSTRAINT_TYPE: "R",
    //         },
    //     ],
    //     tableColumns: [
    //         { prop: "TABLE_NAME", label: "TABLE_NAME" },
    //         { prop: "CONSTRAINT_NAME", label: "CONSTRAINT_NAME" },
    //         { prop: "CONSTRAINT_TYPE", label: "CONSTRAINT_TYPE" },
    //     ],
    // },
    // {
    //     id: 17,
    //     statement: "INSERT INTO department VALUES(666, '数据库产品中心');",
    // },
    // {
    //     id: 18,
    //     statement:
    //         "INSERT INTO employee VALUES(999, '张三','2010-01-26 00:00:00', 30000, 666);",
    // },
    // {
    //     id: 19,
    //     statement: "commit;",
    // },
    // {
    //     id: 20,
    //     statement: "UPDATE employee SET salary='35000' WHERE employee_id=9999;",
    // },
    // {
    //     id: 21,
    //     statement: "commit;",
    // },
    // {
    //     id: 22,
    //     statement: "SELECT salary,employee_id FROM employee;",
    //     output: [{ SALARY: "35000", EMPLOYEE_ID: 9999 }],
    //     tableColumns: [
    //         { prop: "SALARY", label: "SALARY" },
    //         { prop: "EMPLOYEE_ID", label: "EMPLOYEE_ID" },
    //     ],
    // },
    // {
    //     id: 23,
    //     statement: "DELETE FROM employee;",
    // },
    // {
    //     id: 24,
    //     statement: "DELETE FROM department WHERE department_id=666;",
    // },
    // {
    //     id: 25,
    //     statement: "commit;",
    // },
    // {
    //     id: 26,
    //     statement: "SELECT * FROM employee;",
    //     output: [],
    //     tableColumns: [
    //         { prop: "EMPLOYEE_ID", label: "EMPLOYEE_ID" },
    //         { prop: "EMPLOYEE_NAME", label: "EMPLOYEE_NAME", width: "150px" },
    //         { prop: "HIRE_DATE", label: "HIRE_DATE" },
    //         { prop: "SALARY", label: "SALARY" },
    //         { prop: "DEPARTMENT_ID", label: "DEPARTMENT_ID", width: "150px" },
    //     ],
    // },
    // {
    //     id: 27,
    //     time: 351,
    //     statement:
    //         "CREATE TABLE t1 AS\n SELECT rownum AS id,\n trunc(dbms_random.value(0, 100)) AS random_id,\n dbms_random.string('x', 20) AS random_string\n FROM dual\n connect BY level <= 100000;",
    // },
    // {
    //     id: 28,
    //     statement: "SELECT COUNT(*) FROM t1;",
    //     output: [{ count: "100000" }],
    //     tableColumns: [{ prop: "count", label: "COUNT(*)" }],
    // },
    
];
